clear all

import excel "panel_all.xlsx", sheet("Sheet1") firstrow

xtset fixedeffectdummy year, delta(2)

/* store result */
matrix result=J(10,4,.)

reghdfe incpc p_m3 p_m2 p_0 p_p1 p_p2 p_m3xt p_m2xt p_0xt p_p1xt p_p2xt, absorb(i.year i.fixedeffectdummy) vce(cluster fixedeffectdummy) noconstant
matrix A2=r(table)
reghdfe num_worker p_m3 p_m2 p_0 p_p1 p_p2 p_m3xt p_m2xt p_0xt p_p1xt p_p2xt, absorb(i.year i.fixedeffectdummy) vce(cluster fixedeffectdummy) noconstant
matrix A1=r(table)
reghdfe entre p_m3 p_m2 p_0 p_p1 p_p2 p_m3xt p_m2xt p_0xt p_p1xt p_p2xt, absorb(i.year i.fixedeffectdummy) vce(cluster fixedeffectdummy) noconstant
matrix A3=r(table)
reghdfe credit p_m3 p_m2 p_0 p_p1 p_p2 p_m3xt p_m2xt p_0xt p_p1xt p_p2xt, absorb(i.year i.fixedeffectdummy) vce(cluster fixedeffectdummy) noconstant
matrix A4=r(table)


forvalues i = 1/4 {
	matrix result[1,`i']= A`i'[1,6]
	matrix result[2,`i']= A`i'[2,6]
	
	matrix result[3,`i']= A`i'[1,7]
	matrix result[4,`i']= A`i'[2,7]
	
	matrix result[5,`i']= A`i'[1,8]
	matrix result[6,`i']= A`i'[2,8]
	
	matrix result[7,`i']= A`i'[1,9]
	matrix result[8,`i']= A`i'[2,9]
	
	matrix result[9,`i']= A`i'[1,10]
	matrix result[10,`i']= A`i'[2,10]
	
	
}

matrix list result

putexcel set "results.xlsx", replace
putexcel A1=matrix(result), names